//
//  FenLeiDetailSearchHomeView.m
//  Experss
//
//  Created by wmwMAC on 17/7/31.
//  Copyright © 2017年 嗯，大葱. All rights reserved.
//

#import "FenLeiDetailSearchHomeView.h"

@implementation FenLeiDetailSearchHomeView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self addOtherUI];
    }
    return self;
}


-(void)addOtherUI {
    
    UIImageView *backImgView = [BasePublicCreatUI createImageViewFrame:CGRectMake(0, 0, kScreen_Width, self.frame.size.height) imageName:@"bg1" color:[UIColor whiteColor]];
    [self addSubview:backImgView];
    
    _leftBtn = [BasePublicCreatUI createBtnFrame:CGRectMake(5, 2, (180*kScreen_Width)/1242, 40) title:nil bgImage:nil selectBgImage:nil image:@"all_fanhui2" target:self action:@selector(locationbuttonclick:)];
        [_leftBtn setImage:KGetImage(@"homeLocation") forState:UIControlStateNormal];
        _leftBtn.tintColor = [UIColor whiteColor];
        _leftBtn.tag = 100;
        [self addSubview:_leftBtn];
    
    
    UITextField *searchtext = [BasePublicCreatUI createTextFielfFrame:CGRectMake((180*kScreen_Width)/1242+15, 7, kScreen_Width-(180*kScreen_Width)/1242-80, 30) font:kFont14 placeholder:nil];
    searchtext.layer.cornerRadius = 15;
    searchtext.layer.masksToBounds = YES;
    UIImageView *smallImageView = [BasePublicCreatUI createImageViewFrame:CGRectMake(10, 7, 15, 15)  imageName:@"fenlei_sousuo" color:[UIColor clearColor]];
    searchtext.userInteractionEnabled = NO;
    smallImageView.backgroundColor = [UIColor grayColor];
    searchtext.enabled = NO;
    UIView *leftview= [[UIView alloc] initWithFrame:CGRectMake(0, 0, 30, 30)];
    [leftview addSubview:smallImageView];
    searchtext.leftView = leftview;
    searchtext.backgroundColor = kRGB(241, 245,252);
    searchtext.text = @"请出入您想搜索的内容";
    searchtext.textColor = [UIColor lightGrayColor];
    [self addSubview:searchtext];
    _searchBtn = [BasePublicCreatUI createBtnFrame:searchtext.frame  title:nil bgImage:nil selectBgImage:nil image:nil target:self action:@selector(locationbuttonclick:)];
    _searchBtn.tag = 101;
    [self addSubview:_searchBtn];
    _rightBtn = [BasePublicCreatUI createBtnFrame:CGRectMake(CGRectGetMaxX(searchtext.frame)+10, 7, (150*kScreen_Width)/1242, 30) title:nil bgImage:nil selectBgImage:nil image:nil target:self action:@selector(locationbuttonclick:)];
    [_rightBtn setImage:KGetImage(@"fenlei_xiaoxi") forState:UIControlStateNormal];
    _rightBtn.tag = 102;
    [self addSubview:_rightBtn];
    
}


-(void)locationbuttonclick:(UIButton *)sender {
        if (sender.tag == 100) {
            [self.delegate leftButtonclcik];
        }else if (sender.tag ==101){
        [self.delegate middlebuttonclcik];
    }else {
        [self.delegate rightButtonclcik];
    }
}


@end
